#ifndef Base_ElapsedTimer_h
#define Base_ElapsedTimer_h

#include "BaseModule.h"
#include <chrono>

SG_NAMESPACE_OPEN

namespace Base
{
    /**
    * @brief Profiling tools to compute the elapsed times.
    * 
    * Minic QElapsedTimer to quickly calculate how much time has elapsed
    * between two events.
    * @see https://doc.qt.io/qt-6/qelapsedtimer.html
    * 
    * @author nene
    * @date Augst, 2024.
    */
    class BASE_EXPORT ElapsedTimer
    {
    public:
        ElapsedTimer();

        /// start this timer.
        void start();

        /// the number of milliseconds since the last started.
        int64_t elapsed();

        /// Restarts the timer and returns the number of milliseconds
        /// elapsed since the previous start. 
        int64_t restart();

    protected:
        std::chrono::system_clock::time_point t1, t2;         
    };
}

SG_NAMESPACE_CLOSE

#endif  // Base_ElapsedTimer_h